package com.sinotrust.classify.mba;

import java.util.HashMap;
import java.util.Map;

import com.sinotrust.classify.DefaultAlgorithm;

public class MbaManager {
	private static Map<String, String> classMap;
	private static String SVM_CLASS_MODEL = "com.sinotrust.classify.mba.model.SVMmodel";
	private static String KNN_CLASS_MODEL = "KNN_MODEL";
	public static void init() {
		classMap = new HashMap<String, String>();
		classMap.put("SVM", SVM_CLASS_MODEL);
		classMap.put("KNN", KNN_CLASS_MODEL);
	}
	public static DefaultMba lookup(String key){
		String className = classMap.get(key);
		
		try {
			return (DefaultMba)Class.forName(className).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
			return null;
		} catch (IllegalAccessException e) {
			e.printStackTrace();
			return null;
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			return null;
		}
	}
}
